package jumpingnotes.model.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "audio", catalog = "jumping_notes")
public class Audio implements java.io.Serializable
{

	private Integer audioId;
	private RecordTask recordTask;
	private Sync sync;
	private Integer flvAudioId;
	private Integer type;
	private Integer subtype;
	private String name;
	private String uuid;
	private Integer memberId;
	private String collabMemberIds;
	private Integer rating;
	private Integer ratingTotal;
	private Integer ratingCount;
	private Integer playCount;
	private Integer duration;
	private Integer downloadCount;
	private Date createTime;
	private Set<Deploy> deploies = new HashSet<Deploy>(0);

	public Audio()
	{
	}

	public Audio(RecordTask recordTask)
	{
		this.recordTask = recordTask;
	}

	public Audio(RecordTask recordTask, Sync sync, Integer flvAudioId, Integer type, Integer subtype, String name,
			String uuid, Integer memberId, String collabMemberIds, Integer rating, Integer ratingTotal,
			Integer ratingCount, Integer playCount, Date createTime, Set<Deploy> deploies)
	{
		this.recordTask = recordTask;
		this.sync = sync;
		this.flvAudioId = flvAudioId;
		this.type = type;
		this.subtype = subtype;
		this.name = name;
		this.uuid = uuid;
		this.memberId = memberId;
		this.collabMemberIds = collabMemberIds;
		this.rating = rating;
		this.ratingTotal = ratingTotal;
		this.ratingCount = ratingCount;
		this.playCount = playCount;
		this.createTime = createTime;
		this.deploies = deploies;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "audio_id", unique = true, nullable = false)
	public Integer getAudioId()
	{
		return this.audioId;
	}

	public void setAudioId(Integer audioId)
	{
		this.audioId = audioId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "record_task_id", nullable = false)
	public RecordTask getRecordTask()
	{
		return this.recordTask;
	}

	public void setRecordTask(RecordTask recordTask)
	{
		this.recordTask = recordTask;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "sync_id")
	public Sync getSync()
	{
		return this.sync;
	}

	public void setSync(Sync sync)
	{
		this.sync = sync;
	}

	@Column(name = "flv_audio_id")
	public Integer getFlvAudioId()
	{
		return this.flvAudioId;
	}

	public void setFlvAudioId(Integer flvAudioId)
	{
		this.flvAudioId = flvAudioId;
	}

	@Column(name = "type")
	public Integer getType()
	{
		return this.type;
	}

	public void setType(Integer type)
	{
		this.type = type;
	}

	@Column(name = "subtype")
	public Integer getSubtype()
	{
		return this.subtype;
	}

	public void setSubtype(Integer subtype)
	{
		this.subtype = subtype;
	}

	@Column(name = "name", length = 100)
	public String getName()
	{
		return this.name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	@Column(name = "uuid", length = 100)
	public String getUuid()
	{
		return this.uuid;
	}

	public void setUuid(String uuid)
	{
		this.uuid = uuid;
	}

	@Column(name = "member_id")
	public Integer getMemberId()
	{
		return this.memberId;
	}

	public void setMemberId(Integer memberId)
	{
		this.memberId = memberId;
	}

	@Column(name = "collab_member_ids")
	public String getCollabMemberIds()
	{
		return this.collabMemberIds;
	}

	public void setCollabMemberIds(String collabMemberIds)
	{
		this.collabMemberIds = collabMemberIds;
	}

	@Column(name = "rating")
	public Integer getRating()
	{
		return this.rating;
	}

	public void setRating(Integer rating)
	{
		this.rating = rating;
	}

	@Column(name = "rating_total")
	public Integer getRatingTotal()
	{
		return this.ratingTotal;
	}

	public void setRatingTotal(Integer ratingTotal)
	{
		this.ratingTotal = ratingTotal;
	}

	@Column(name = "rating_count")
	public Integer getRatingCount()
	{
		return this.ratingCount;
	}

	public void setRatingCount(Integer ratingCount)
	{
		this.ratingCount = ratingCount;
	}

	@Column(name = "play_count")
	public Integer getPlayCount()
	{
		return this.playCount;
	}

	public void setPlayCount(Integer playCount)
	{
		this.playCount = playCount;
	}

	@Column(name = "duration")
	public Integer getDuration()
	{
		return this.duration;
	}

	public void setDuration(Integer duration)
	{
		this.duration = duration;
	}

	@Column(name = "download_count")
	public Integer getDownloadCount()
	{
		return this.downloadCount;
	}

	public void setDownloadCount(Integer downloadCount)
	{
		this.downloadCount = downloadCount;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", length = 19)
	public Date getCreateTime()
	{
		return this.createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "audio")
	public Set<Deploy> getDeploies()
	{
		return this.deploies;
	}

	public void setDeploies(Set<Deploy> deploies)
	{
		this.deploies = deploies;
	}

}
